import { Service } from "cl-admin";
import BaseService from "@/service/base";

// @Service("base/open")
class Open extends BaseService {
	/**
	 * 选择事业部用户登录
	 *
	 * @param {*} { username, password, captchaId, verifyCode }
	 * @returns
	 * @memberof CommonService
	 */
	selectUserLogin(params) {
		return this.$post("/index/login", params);
	}
	javaSelectUserLogin(params) {
		return this.$post("/blade-auth/login", params, { javaUrl: true, formData: true });
	}
	/**
	 * 用户登录
	 *
	 * @param {*} { username, password, captchaId, verifyCode }
	 * @returns
	 * @memberof CommonService
	 */
	userLogin(params) {
		return this.$post("/index/ddlogin", params);
	}

	javaUserLogin(params) {
		return this.$post("/blade-auth/ddlogin", params, { javaUrl: true, formData: true });
	}

	ddLogin(params) {
		return this.$post("/index/dingTalkLogin", params);
	}
	/**
	 * 图片验证码 svg
	 *
	 * @param {*} { height, width }
	 * @returns
	 * @memberof CommonService
	 */
	captcha({ height, width }) {
		return this.$get("/captcha", { params: { height, width } });
	}

	/**
	 * 刷新 token
	 * @param {string} token
	 */
	refreshToken(refreshToken) {
		return this.$get("/refreshToken", { params: { refreshToken } });
	}

	/**
	 * 获取biz信息
	 */
	bizInfo(params) {
		return this.$get("/index/bizinfo", { params });
	}
}

export default Open;
